<template>
	<div>
		<!-- 开启滑动 -->
		<scroll-view scroll-y="true">
			<div class="headeBox">
				<div style="display: flex;justify-content: flex-end;height: 2em;padding-top: 1.5em;">
					<!-- 扫码，设置 -->
					<span @click="scancode">
						<van-icon name="scan" size="1.25em" class="ico">

						</van-icon>
					</span>
					<span @click="settings()">
						<van-icon name="setting-o" size="1.25em" class="ico" style="padding-right: 1.5em;" />
					</span>
				</div>

				<div style="margin-left: 1em;" @click="userDetails">
					<div style="height: 6em;display: flex;align-items: center;">
						<div @click="settings()" class="profile">
							<!-- 用户头像 -->
							<open-data type="userAvatarUrl"></open-data>
						</div>

						<div style="margin-left: .75em;">
							<div class="followInfo">
								<!-- 用户关注信息 -->
								<div>
									<span style="margin-right: .25em;">0</span>
									<span>评论</span>
								</div>
								<div><span style="margin-right: .25em;">0</span>
									<span>关注</span>
								</div>
								<div><span style="margin-right: .25em;">0</span>
									<span>粉丝</span>
								</div>
							</div>
							<div style="padding-top: 5px;">
								<!-- 用户基本资料 -->
								<van-button @click="userinfo()" round color="#fab623" size="small">
									<span style="color: #000000;font-size: 12px;">编辑资料</span>
								</van-button>
							</div>
						</div>
					</div>

					<div style="padding-bottom: 1em;">
						<div style="display: flex;">
							<div style="margin-right: 1em;font-size: 1em;">
								<open-data type="userNickName"></open-data>
							</div>
							<div>
								<van-icon name="location-o" />
								<open-data type="userCity"></open-data>成都
							</div>
						</div>
						<div>
							<div style="margin-top: .75em;font-size: 14px;">{{userSign!=''? userSign:'无'}}</div>
						</div>
					</div>
				</div>

			</div>



			<van-cell is-link title="我的票卷" link-type="navigateTo" url="/pages/my/details">
				全部
			</van-cell>

			<div @click="infos">
			    <van-grid column-num="5">
			     <van-grid-item icon="coupon-o" text="待参加" />
			     <van-grid-item icon="completed" text="待审核" />
			     <van-grid-item icon="after-sale" text="待支付" />
			     <van-grid-item icon="peer-pay" text="退票" />
			     <van-grid-item icon="records" text="待评价" />
			    </van-grid>
			   </div>
				<van-grid column-num="5">
					<van-grid-item icon="coupon-o" text="待参加" />
					<van-grid-item icon="completed" text="待审核" />
					<van-grid-item icon="after-sale" text="待支付" />
					<van-grid-item icon="peer-pay" text="退票" />
					<van-grid-item icon="records" text="待评价" />
				</van-grid>
			</div>


			<div style="margin-top: .3em;">
				<van-cell icon="gift-o" is-link title="我的优惠卷" link-type="navigateTo" url="/pages/dashboard/index">
					全部
				</van-cell>
			</div>

			<div style="margin-top: .3em;">
				<van-cell icon="edit" is-link title="发布活动" link-type="navigateTo" url="/pages/dashboard/index" />
				<van-cell icon="guide-o" is-link title="我发布的" link-type="navigateTo" url="/pages/dashboard/index" />
				<van-cell icon="star-o" is-link title="我的收藏" link-type="navigateTo" url="/pages/dashboard/index" />
				<van-cell icon="friends-o" is-link title="邀请好友" link-type="navigateTo" url="/pages/dashboard/index" />
				<van-cell icon="service-o" is-link title="意见反馈" link-type="navigateTo" url="/pages/dashboard/index" />
			</div>
		</scroll-view>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				userSign: ''
			}
		},
		methods: {
			infos(){
			    uni.navigateTo({
			     url: "/pages/order/detail"
			    })
			   },
			settings() {
				uni.navigateTo({
					url: "/pages/my/set"
				})
			},
			scancode() {
				wx.scanCode({
					success(res) {
						console.log(res)
					}
				})
			},
			userinfo() {
				uni.navigateTo({
					url: "/pages/my/userinfo"
				})
			},
			loaderData() {
				uni.request({
					url: 'http://localhost:8080/userinfo/user/findUserData', //仅为示例，并非真实接口地址。
					timeout: 5000,
					header: {
						'Authorization': wx.getStorageSync('Authorization')
					},
					success: (res) => {
						console.log(res);
					}
				});
			}
		},
		mounted() {
			uni.request({
				url: 'http://localhost:7070/signin', //加数据
				data: {
					"username": "tom",
					"password": "123"
				},
				method: 'POST',
				success: (res) => {
					wx.setStorageSync("Authorization", res.data.data)
				}
			});

		}
	}
</script>

<style>
	.profile {
		overflow: hidden;
		display: block;
		width: 75px;
		height: 75px;
		border-radius: 50%;
		border: 2px solid #fff;
		box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
	}

	.headeBox {
		background-color: #DCDFE6;
	}

	.ico {
		margin: 0 .5em;
	}

	.followInfo {
		display: flex;
		padding-bottom: 5px;
	}

	.followInfo>div {
		margin-right: 1.5em;
		font-size: 12px;
	}
</style>
